Skip to content

Add Groundlight.me() for authenticated identity - #468

Open
timmarkhuff wants to merge 13 commits into
mainfrom
thuff/add-me-method
Open

Add Groundlight.me() for authenticated identity#468
timmarkhuff wants to merge 13 commits into
mainfrom
thuff/add-me-method

Conversation

@timmarkhuff

@timmarkhuff timmarkhuff commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This PR lets SDK users fetch authenticated identity, including the user's group:

with Groundlight(enable_token_rotation=False) as gl:
    me = gl.me()
    print(me.email, me.group.id, me.group.name)

Summary of Changes

  • Adds Groundlight.me() returning pydantic Me (email, username, group) from GET /v1/me.
  • Adds small Me / Group models in generated/model.py and a surgical spec/public-api.yaml sync.
  • Does not regenerate the openapi-client Me/Group models; InlineResponse2002 already passes through extra fields via to_dict().
  • whoami() now returns me().email; CLI picks up me under Account.

Merge order

  1. Merge zuuul #6707 first (runtime + OpenAPI must return singular group).
  2. Then merge this PR.

Test plan

  • Unit tests for me() / group models
  • CI green (needs zuuul #6707 deployed where integration hits live /v1/me)

Tim Huff and others added 3 commits July 30, 2026 18:34
Expose id, email, username, and customer groups from GET /v1/me so
callers can inspect the token's tenant without parsing the raw response.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid colliding with detector-group concepts; callers that need the
type can import it from groundlight.identity.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/groundlight/identity.py Outdated
name: str = Field(..., description="Name of the customer group.")


class Me(BaseModel): # pylint: disable=too-few-public-methods

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to get this model for free from the api spec if we model it appropriately in the BE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I opened a separate PR to update the backend.

Tim Huff and others added 10 commits July 31, 2026 12:58
Replace hand-written identity models with codegen from the updated
/v1/me schema, and sync spec/public-api.yaml from zuuul.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Import generated models from model, matching other unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Revert accidental full-client regenerate noise and keep only the
/v1/me schema and generated Me/CustomerGroup wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Align with zuuul public contract: nested groups use Group, Me omits user id, keep plural groups with id+name.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep /v1/me contract changes in the YAML and model.py Me/Group types, and drop generated openapi-client Me/Group churn. InlineResponse2002 already carries the extra fields through to_dict().

Co-authored-by: Cursor <cursoragent@cursor.com>
Match the public API contract that returns one group object instead of a list.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep parity with the public /v1/me contract that released clients still require.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants